package com.qifan.energy.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qifan.energy.bean.result.BalanceHistorySearchItem;
import com.qifan.energy.R;
import com.qifan.energy.global.Values;
import com.qifan.energy.util.DateTimeUtils;

import java.util.List;

public class RoomEarningsListAdapter extends BaseQuickAdapter<BalanceHistorySearchItem,BaseViewHolder> {

    public RoomEarningsListAdapter(@Nullable List<BalanceHistorySearchItem> data) {
        super(R.layout.roomearnings_list_item, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, BalanceHistorySearchItem item) {
        //UI赋值
        helper.setText(R.id.income_tv,String.format("+%.02f",item.getChangeAmount()))
                .setText(R.id.time_tv,String.format("%s",DateTimeUtils.getDateStr(item.getCreateTime(), Values.DateFormatType.yyyyMMdd_HHmm)));
    }
}
